package com.proba.annotations.pojo;

import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.samples.mvc.basic.model.Identifiable;

@Entity
@Table(name = "EDINICA_MERKA", schema = "MAVROVO")
@SuppressWarnings("serial")
@javax.persistence.SequenceGenerator(
    name="edinica_merka_seq",
    sequenceName="edinica_merka_seq", allocationSize=1
)
public class EdinicaMerka implements Identifiable {

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		EdinicaMerka other = (EdinicaMerka) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	/**
	 * Attribute id.
	 */
	private Long id;
	
	/**
	 * Attribute edinicaMerka.
	 */
	private String edinicaMerka;
	
	/**
	 * Attribute edinicaMerkaLabel.
	 */
	private String edinicaMerkaLabel;
	
	/**
	 * Attribute edit.
	 */
	private String edit;
	
	/**
	 * List of GotovProizvod
	 */
	private List<GotovProizvod> gotovProizvods = null;

	
	/**
	 * @return id
	 */
	@Basic
	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="edinica_merka_seq")
		public Long getId() {
		return id;
	}

	/**
	 * @param id new value for id 
	 */
	public void setId(Long id) {
		this.id = id;
	}
	
	/**
	 * @return edinicaMerka
	 */
	@Basic
	@Column(name = "EDINICA_MERKA", length = 6)
		public String getEdinicaMerka() {
		return edinicaMerka;
	}

	/**
	 * @param edinicaMerka new value for edinicaMerka 
	 */
	public void setEdinicaMerka(String edinicaMerka) {
		this.edinicaMerka = edinicaMerka;
	}
	
	/**
	 * @return edinicaMerkaLabel
	 */
	@Basic
	@Column(name = "EDINICA_MERKA_LABEL", length = 40)
		public String getEdinicaMerkaLabel() {
		return edinicaMerkaLabel;
	}

	/**
	 * @param edinicaMerkaLabel new value for edinicaMerkaLabel 
	 */
	public void setEdinicaMerkaLabel(String edinicaMerkaLabel) {
		this.edinicaMerkaLabel = edinicaMerkaLabel;
	}
	
	/**
	 * @return edit
	 */
	@Basic
	@Column(name = "EDIT", length = 40)
		public String getEdit() {
		return edit;
	}

	/**
	 * @param edit new value for edit 
	 */
	public void setEdit(String edit) {
		this.edit = edit;
	}
	
	 
	/**
	 * Set the list of GotovProizvod
	 */
	 public void setGotovProizvods(List<GotovProizvod> gotovProizvods) {
	 	this.gotovProizvods = gotovProizvods;
	 }
	/**
	 * Get the list of GotovProizvod
	 */
	 @OneToMany(mappedBy="edinicaMerka")
	 public List<GotovProizvod> getGotovProizvods() {
	 	return this.gotovProizvods;
	 }
	 
	 public String toString() {
		 return this.getEdinicaMerka();
	 }



}